package com.flitsneak.designpatterns.creationalpatterns.prototype;

/**
 * @author flitsneak
 * @email flitsneak@gmail.com
 * @date 2022/7/7 10:27
 * @description
 */
public class Origami implements Cloneable{

    private String type;

    private int papers;

    public Origami(String type,int papers) {
        this.type = type;
        this.papers = papers;
        System.out.println("手工折纸");
    }

    public void setType(String type) {
        this.type = type;
    }

    public void setPapers(int papers){
        this.papers = papers;
    }

    public void show(){
        System.out.println("用了"+papers+"张纸折了个"+type);
    }

    @Override
    public Origami clone(){
        Origami origami = null;
        try {
            System.out.println("折纸复制成功。");
            origami = (Origami)super.clone();
        } catch (CloneNotSupportedException e){
            System.out.println(e.getMessage());
        }
        return origami;
    }
}
